<template>
  <div class="">
    <el-dialog
      :title="'请输入不通过愿意描述'"
      :visible.sync="dialogVisible"
      width="30%"
      :before-close="handleClose"
    >
      <el-form ref="form" :model="form" label-width="120px">
        <el-form-item label="不通过原因描述" :rules="rules.def">
          <el-input v-model="form.msg" type="textarea" />
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="query">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
export default {
  name: 'Reason',
  data() {
    return {
      dialogVisible: false,
      subscribeName: '',
      form: {
        msg: '',
        id: '',
        isPass: false
      },
      rules: this.$ruleStore.rules
    }
  },
  methods: {
    show(row) {
      this.dialogVisible = true
      this.subscribeName = row.subscribeName
      this.form.id = row.id
    },
    query() {
      var that = this
      const url = that.$http.conf.api.get('wms').url + '/api/logistics/car-subscribe/audio'
      that.$http.post(url, this.form)
        .then(function(rsp) {
          if (rsp.code !== 200) {
            that.$message.error(rsp.message)
            return
          }
          that.$message.success('操作成功!')
          that.dialogVisible = false
          that.$emit('verifyQuery', that.form)
        })
        .catch(function(err) {
          // that.$message.error('服务端异常')
          console.log(err)
        })
    },
    handleClose() {
      this.form.msg = ''
      this.dialogVisible = false
    }
  }

}
</script>

<style>

</style>
